<script setup lang="ts">
import type { ChannelItem } from '@/types';
// 父传子接收
defineProps<{
  channels: ChannelItem[]
  activeId: number
}>()

// 子传父
const emits = defineEmits<{
  'updateActiveId': [activeId: number]
}>()
</script>



<template>
  <div class="channel-nav">
    <nav class="list">
      <!-- 点击事件 -->
      <a @click="emits('updateActiveId', item.id)" class="item" :class="{ active: item.id === activeId }"
        href="javascript:;" v-for="item in channels" :key="item.id">
        {{ item.name }}
      </a>
    </nav>
  </div>
</template>